ETH_ADDRESS = "0x0000000000000000000000000000000000000000"

# see: https://chainid.network/chains/
netid_to_name = {
    1: "mainnet",
    3: "ropsten",
    4: "rinkeby",
    56: "binance",
    97: "binance_testnet",
    100: "xdai",
    42161: "arbitrum",
}

BLOCKCHAIN_NAME_TO_CHAINID = {
    "ethereum": 1,
    "arbitrum": 42161,
    "bsc": 56,
}

# For v2 the address is the same on mainnet, Ropsten, Rinkeby, Görli, and Kovan
# https://uniswap.org/docs/v2/smart-contracts/factory
UNISWAP_V2_FACTORY_CONTRACT_ADDRESS = {
    "mainnet": "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
    "binance": "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73",
}

UNISWAP_V2_ROUTER_CONTRACT_ADDRESS = {
    "mainnet": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
    "binance": "0x10ED43C718714eb63d5aA57B78B54704E256024E",
}

UNISWAP_V3_QUOTER_CONTRACT_ADDRESS = {
    "mainnet": "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6",
    "arbitrum": "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6",
}

UNISWAP_V3_ROUTER_CONTRACT_ADDRESS = {
    "mainnet": "0xE592427A0AEce92De3Edee1F18E0157C05861564",
    "arbitrum": "0xE592427A0AEce92De3Edee1F18E0157C05861564",
}

TOKEN_TO_ADDRESS = {
    "ethereum": {
        "ETH": "0x0000000000000000000000000000000000000000",
        "WETH": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
        "DAI": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
        "USDC": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
        "BAT": "0x0D8775F648430679A709E98d2b0Cb6250d2887EF",
        "WBTC": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
        "UNI": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
        "SHIBA2": "0xA0335820dC549dBfae5b8D691331CadfCA7026E0",
        "USDT": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
        "CCX": "0x1D6405138A335cE5FD7364086334EfB3E4F28B59",
        "MUSA": "0x486a3c5f34cDc4EF133f248f1C81168D78da52e8",
    },
    "arbitrum": {
        "ETH": "0x0000000000000000000000000000000000000000",
        "WETH": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
        "USDC": "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8",
        'ARB': "0x912CE59144191C1204E64559FE8253a0e49E6548",
        "USDT": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
        "WBTC": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
        "UNI": "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0",
        "DAI": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
        "CCX": "dummy",
    }
}

# From Subgraph
TOKEN_TO_DECIMAL_MULTIPLIER = {
    "ETH": 1e-18,
    "WETH": 1e-18,
    "DAI": 1e-18,
    "USDC": 1e-6,
    "BAT": 1e-18,
    "WBTC": 1e-8,
    "UNI": 1e-18,
    "SHIBA2": 1e-18,
    "USDT": 1e-6,
    "CCX": 1e-18,
    "ARB": 1e-18,
    "MUSA": 1e-18,
}

TOKEN_TO_DECIMAL = {
    "ETH": 18,
    "WETH": 18,
    "DAI": 18,
    "USDC": 6,
    "BAT": 18,
    "WBTC": 8,
    "UNI": 18,
    "SHIBA2": 18,
    "USDT": 6,
    "CCX": 18,
    "ARB": 18,
    "MUSA": 18,
}

ADDR_TO_DECIMAL_MULTIPLIER = {
    "0x0000000000000000000000000000000000000000": 1e-18,
    "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2": 1e-18,
    "0x6B175474E89094C44Da98b954EedeAC495271d0F": 1e-18,
    "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48": 1e-6,
    "0x0D8775F648430679A709E98d2b0Cb6250d2887EF": 1e-18,
    "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599": 1e-8,
    "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984": 1e-18,
    "0xA0335820dC549dBfae5b8D691331CadfCA7026E0": 1e-18,
    "0xdAC17F958D2ee523a2206206994597C13D831ec7": 1e-6,
    "0x1D6405138A335cE5FD7364086334EfB3E4F28B59": 1e-18,
    "0x486a3c5f34cDc4EF133f248f1C81168D78da52e8": 1e-18,
    # Arbitrum case
    "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1": 1e-18,
    "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8": 1e-6,
    "0x912CE59144191C1204E64559FE8253a0e49E6548": 1e-18,
    "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9": 1e-6,
    "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f": 1e-8,
    "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0": 1e-18,
}

BP_TO_POOL_FEE_MULTIPLIER = 100

SYMBOL_TO_ADDRESS = {
    "ethereum": {
        "ETH-USDC.5bp": "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640",
        "ETH-USDC.30bp": "0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8",
        "ETH-USDT.5bp": "0x11b815efB8f581194ae79006d24E0d814B7697F6",
        "ETH-BTC.5bp": "0x4585FE77225b41b697C938B018E2Ac67Ac5a20c0",
        "USDC-USDT.1bp": "0x3416cf6c708da44db2624d63ea0aaef7113527c6",
        "ETH-USDT.30bp": "0x4e68ccd3e89f51c3074ca5072bbac773960dfa36",
        "ETH-DAI.5bp": "0x60594a405d53811d3BC4766596EFD80fd545A270",
        "ETH-BTC.30bp": "0xcbcdf9626bc03e24f779434178a73a0b4bad62ed",
        "ETH-DAI.30bp": "0xc2e9f25be6257c210d7adf0d4cd6e3e881ba25f8",
        "USDC-DAI.1bp": "0x5777d92f208679db4b9778590fa3cab3ac9e2168",
        "BTC-USDC.30bp": "0x99ac8cA7087fA4A2A1FB6357269965A2014ABc35",
        "USDC-USDT.5bp": "0x7858e59e0c01ea06df3af3d20ac7b0003275d4bf",
        "USDC-DAI.5bp": "0x6c6bc977e13df9b0de53b251522280bb72383700",
        "APE-ETH.30bp": "0xac4b3dacb91461209ae9d41ec517c2b9cb1b7daf",
        "LINK-ETH.30bp": "0xa6cc3c2531fdaa6ae1a3ca84c2855806728693e8",
        "UNI-ETH.30bp": "0x1d42064fc4beb5f8aaf85f4617ae8b3b5b8bd801",
        "MUSA-ETH.100bp": "0x20CD08CC4Bfe9754022bcefE9A30AF843567cAA1",
        "ETH-USDC": "0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc",
        "ETH-USDT": "0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852",
        "CCX-ETH": "0x39159C61d549742589E807aDF2Ff2C4Ca8391093",
    },
    "arbitrum": {
        "ETH-USDC.5bp": "0xC31E54c7a869B9FcBEcc14363CF510d1c41fa443",
        "ETH-USDC.30bp": "0x17c14D2c404D167802b16C450d3c99F88F2c4F4d",
        "ETH-USDT.5bp": "0x641C00A822e8b671738d32a431a4Fb6074E5c79d",
        "ARB-USDC.5bp": "0xcDa53B1F66614552F834cEeF361A8D12a0B8DaD8",
    }
}

MAX_UINT_256 = int(
    "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", base=16
)

MAX_UINT_128 = 340282366920938463463374607431768211455

# from https://github.com/wbobeirne/eth-balance-checker
balance_checker_deployment_address = {
    'mainnet': '0xb1f8e55c7f64d203c1400b9d8555d050f94adf39',
    'ropsten': '0x8D9708f3F514206486D7E988533f770a16d074a7',
    'rinkeby': '0x3183B673f4816C94BeF53958BaF93C671B7F8Cf2',
    'kovan': '0x55ABBa8d669D60A10c104CC493ec5ef389EC92bb',
    'goerli': '0x9788C4E93f9002a7ad8e72633b11E8d1ecd51f9b',
    'binance smart chain mainnet': '0x2352c63A83f9Fd126af8676146721Fa00924d7e4',
    'binance smart chain testnet': '0x2352c63A83f9Fd126af8676146721Fa00924d7e4',
    'polygon': '0x2352c63A83f9Fd126af8676146721Fa00924d7e4',
    'mumbai': '0x2352c63A83f9Fd126af8676146721Fa00924d7e4',
    'Optimism': '0xB1c568e9C3E6bdaf755A60c7418C269eb11524FC',
    'Optimism Kovan': '0xB1c568e9C3E6bdaf755A60c7418C269eb11524FC',
    'arbitrum': '0x151E24A486D7258dd7C33Fb67E4bB01919B7B32c',
    'avalanche': '0xD023D153a0DFa485130ECFdE2FAA7e612EF94818',
    'fantom': '0x07f697424ABe762bB808c109860c04eA488ff92B',
    'ether-classic': '0xfC701A6b65e1BcF59fb3BDbbe5cb41f35FC7E009',
}

PRODUCTION_RPC_URL = {
    # "ethereum": "https://silent-dark-arrow.quiknode.pro/d137df98264cc7f651593af90aa5963237c786cb/",
    "ethereum": "http://18.143.239.137:8545",
    # "arbitrum": "https://practical-capable-uranium.arbitrum-mainnet.quiknode.pro/0a9384de0439a595c24433ec058222d8eeb3d833/",
    "arbitrum": "http://18.143.239.137:8547",
}

ROUGH_ESTIMATE_GAS_LIMIT = 7000000
